package cz.acies.uniql.metadata;

import java.io.Serializable;

import org.dom4j.Element;
import org.dom4j.dom.DOMElement;

import cz.acies.uniql.dialect.Dialect;

public class MetaData implements Serializable, Cloneable
{
	private static final long serialVersionUID = 8667072501740296784L;
	
	private String name = null;
	private Dialect dialect = null;
	private DBMetaData dbmd;
	
	public MetaData() {
	}
	
	// -----  -----------------------------------------------------------------
	
	/* (non-Javadoc)
	 * @see java.lang.Object#clone()
	 */
	@Override
	public Object clone() throws CloneNotSupportedException {
		Object clone = super.clone();
		assert clone instanceof MetaData;
		((MetaData) clone).setName(this.name);
		((MetaData) clone).setDialect(dialect);
		((MetaData) clone).setDBMetaData(dbmd);
		return clone;
	}

	// -----  -----------------------------------------------------------------
	
	/**
	 * @param name
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return
	 */
	public String getName() {
		return this.name;
	}

	// -----  -----------------------------------------------------------------
	
	/**
	 * @return
	 */
	public Dialect getDialect() {
		return dialect;
	}

	/**
	 * @param dialect
	 */
	public void setDialect(Dialect dialect) {
		this.dialect = dialect;
	}

	// -----  -----------------------------------------------------------------
	
	/**
	 * @return the dbmd
	 */
	public DBMetaData dbmd() {
		return this.dbmd;
	}

	/**
	 * @return the dbmd
	 */
	public DBMetaData getDBMetaData() {
		return this.dbmd;
	}

	/**
	 * @param dbmd the dbmd to set
	 */
	public void setDBMetaData(DBMetaData dbmd) {
		this.dbmd = dbmd;
	}

	// ----- -----------------------------------------------------------------

	public String toString() {
		return getClass().getName() + "(" + getName() + ")";
	}

	// ----- -----------------------------------------------------------------

	/**
	 * Funkce p�etransformuje objekt typu UniQLExpr do XML
	 * 
	 * @param
	 * @return String - n�vratov� hodnota je �et�zec XML
	 */
	public String transToXML() throws Exception {
		return null;
	}

	/**
	 * Funkce p�etransformuje objekt typu UniQLExpr do objekt typu DOMElement
	 * 
	 * @param DOMElement
	 *            node
	 * @return DOMElement
	 */
	public DOMElement transToXML(DOMElement node) throws Exception {
		return null;
	}

	// ----- -----------------------------------------------------------------

	/**
	 * Funkce p�etransformuje �et�zec XML na objekt typu UniQLExpr
	 * 
	 * @param String
	 *            xml
	 * @return UniQLExpr
	 */
	public MetaData xmlToExpr(String xml) throws Exception {
		return this;
	}

	/**
	 * Funkce p�etransformuje objekt typu org.dom4j.Element na objekt typu
	 * UniQLExpr
	 * 
	 * @param Element
	 *            node
	 * @return UniQLExpr
	 */
	public MetaData xmlToExpr(Element node) throws Exception {
		return this;
	}


}
